#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

long long mod = 998244353;

void init(vector<long long>& g, long long n)
{
	long long product = 1;
	for (long long i = 1; i <= n; i++)
	{
		product *= i;
		product %= mod;
		g[i] = product;
	}
}

int main()
{
	long long n = 0;
	cin >> n;
	vector<long long> f(1e6 + 10, 0);
	vector<long long> g(1e6 + 10, 0);
	init(g, n);
	for (long long i = 2; i <= n; i++)
	{
		f[i] = (f[i - 1] * i % mod + i * (i - 1) / 2 % mod * g[i - 1] % mod) % mod;
	}
	cout << f[n] << endl;
	return 0;
}